//
//  DFSongPlayer.h
//  doubanFun
//
//  Created by bing on 16/3/25.
//  Copyright © 2016年 bing. All rights reserved.
//  音乐播放器

#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
#import <MediaPlayer/MediaPlayer.h>

/*!
 *  @brief 当前播放器状态
 */
typedef NS_ENUM(NSInteger, PALYER_ACTION_STATUS) {
    /*!
     *  正在播放
     */
    PALYER_ACTION_STATUS_PLAY,
    /*!
     *  没有播放
     */
    PALYER_ACTION_STATUS_STOP,
};

@class DFSongPlayer;
@protocol DFSongPlayerDelegate <NSObject>

@optional
// 播放进度
- (void)player:(DFSongPlayer *)player song:(DFSong *)song currentTime:(NSTimeInterval)currentTime totalTime:(NSTimeInterval)totlatime;

// 缓存进度
- (void)player:(DFSongPlayer *)player song:(DFSong *)song loadedProgress:(CGFloat)progress;

// 播放结束
- (void)player:(DFSongPlayer *)player endSong:(DFSong *)song;
@end

@interface DFSongPlayer : NSObject

@property (nonatomic, weak) id<DFSongPlayerDelegate> delegate;

+ (instancetype)sharedplayer;
/*!
 *  @brief 流媒体播放
 *
 *  @param song
 */
- (void)setupSongModal:(DFSong *)song;
/*!
 *  @brief 播放
 */
- (void)play;
/*!
 *  @brief 暂停
 */
- (void)pause;
/*!
 *  @brief 停止
 */
- (void)stop;
/*!
 *  @brief 当前播放器的状态
 */
- (PALYER_ACTION_STATUS)status;

/*!
 *  @brief 后台任务
 */
- (void)backgroudTask;
@end
